#{extends 'main.html' /}

<h2>Search Results</h2>
<hr/> %{if (results==0){}%<h3 style="font-style:italic;">Your search returned no results!</h3>
%{} else {}%<h3 style="font-style:italic;">Your search returned ${results} results!</h3>
<img src="/public/images/plus.gif" id='p1' onclick ="javascript:swap('users','p1');"/>
#{if users.size()==0}
	<label style="opacity:0.3;">
	    Users
	</label>
#{/if}
#{else}
	<label style="font-weight:bold">
		Users
	</label>
#{/else}
<div id='users'>
    <ul>
        #{list items:users, as:'user'} 
        <li>
            &nbsp;&nbsp;${user.firstName}&nbsp;${user.middleName}&nbsp;${user.lastName}
        </li>
        #{/list}
    </ul>
</div>
<br/>
<img src="/public/images/plus.gif" id='p2' onclick ="javascript:swap('projects','p2');"/>
#{if projects.size()==0}
	<label style="opacity:0.3;">
	    Projects
	</label>
#{/if}
#{else}
	<label style="font-weight:bold">
	    Projects
	</label>
#{/else}
<div id='projects'>
    <ul>
        #{list items:projects, as:'project'} 
        <li>
            <a href="@{Projects.showProject((Long)project.getEntityId())}">&nbsp;&nbsp;${project.name}</a>
        </li>
        #{/list}
    </ul>
</div>
<br/>
<img src="/public/images/plus.gif" id='p3' onclick ="javascript:swap('components','p3');"/> 
#{if components.size()==0}
	<label style="opacity:0.3;">
	    Components
	</label>
#{/if}
#{else}
	<label style="font-weight:bold">
	    Components
	</label>
#{/else}
<div id='components'>
    <ul>
        #{list items:components, as:'component'} 
        <li>
            <a href="@{Components.showComponent((Long)component.getEntityId(),(Long)component.project.getEntityId())}">&nbsp;&nbsp;${component.name}</a> in project <a href="@{Projects.showProject((Long)component.project.getEntityId())}">${component.project.name}</a>
        </li>
        #{/list}
    </ul>
</div>
<br/>
<img src="/public/images/plus.gif" id='p4' onclick ="javascript:swap('events','p4');"/>
#{if events.size()==0}
	<label style="opacity:0.3;">
	    Events
	</label>
#{/if}
#{else}
	<label style="font-weight:bold">
	    Events
	</label>
#{/else}
<div id='events'>
    <ul>
        #{list items:events, as:'event'} 
        <li>
            <a href="@{Events.showEvent((Long)event.getEntityId())}">&nbsp;&nbsp;${event.name}</a> in project <a href="@{Projects.showProject((Long)event.project.getEntityId())}">${event.project.name}</a>
        </li>
        #{/list}
    </ul>
</div>
%{}}%
<script type="text/javascript">
    function swap(b, p){ //document.getElementById('b').disabled=true;
        document.getElementById(b).style.display = (document.getElementById(b).style.display == "none") ? "block" : "none";
        document.getElementById(p).src = (document.getElementById(b).style.display == "block") ? "/public/images/minus.gif" : "/public/images/plus.gif";
        
    }
    $().ready(function(){
        swap('projects', 'p2');
        swap('users', 'p1');
        swap('events', 'p4');
        swap('components', 'p3');
    });
</script>